﻿#ifndef SYSDEF_H
#define SYSDEF_H

#include <afxtempl.h>


typedef enum enumCOMM_TYPE
{
	COMM_SERIALPORT,
	COMM_NETWORK, 
}COMM_TYPE;

typedef enum enumCOMM_STATUS
{
	COMM_IDLE,
	COMM_SENDING,
	COMM_RECEIVING,
}COMM_STATUS;

//显示屏类型 0-苯乙烯罐区VOC在线监测, 1-轻污油罐区VOC在线监测, 2-供排水, 3-油品, 4-湛江新中美VOCs在线分析
typedef struct tagSysConfig
{
	char szSample_Time[32]; //2021-03-26
	char szLed_Time[32]; 

	char szLed_Title[32]; //显示屏类型抬头
	char szExcel_Sheet[32]; //2021-02-08

	BOOL bCheck_Data; //2021-03-16,是否测试ModBus数据
	BOOL bSend_Led; //2021-03-16,是否发送Led

	enumCOMM_TYPE  nComm_Type; //通讯类型 0-串口, 1-Tcp
	int  nPLC_Register_Type; //2024 - 01 - 28, 0--输入寄存器（AI）地址：30000~39999, 1--输出寄存器（AO）地址：40000~49999
	int  nPLC_Func_Code; //功能码 0x03, 0x04
	int  nPage_Count; //页面数量

	int  nLed_Width;
	int  nLed_Height;

	char szPLC_IP[32];
	int  nTcp_Port;

	int  nSerialPort;
	int  nSerial_Parity; //奇偶校验，N-无校验, O-Odd(奇校验), E-Even(偶校验).
	int  nDev_Addr; //设备地址

	int  nFont_Size;
	int  nFont_Width;

	char szLed_IP[32];
	int  nLed_Port;
	int  nDevID;
	int  nDrv;
	int  nRetryTimes;
	int  nSecTimeOut;

	int  nStay_Time; //画面停留时间
	int  nSample_Minutes; //查询间隔分钟 
	int  nSendLed_Minutes; //发送显示屏间隔分钟, 2021-06-24
	int  nSample_OverTims; //采样通讯超时时间，秒

	int  nExpireLogDays;

	int  nRestartSys_Hour; //重启软件时间
	int  nRestartSys_Minute;

	char szModulePath[MAX_PATH];
	char szModuleName[MAX_PATH];

	char szSys_Path[MAX_PATH];
	char szImg_Path[MAX_PATH];
	char szLed_Path[MAX_PATH];

	int  nCol_Width[4]; //4列

	COLORREF  rgbCell_Color[6][4]; //6行4列, 每cell的颜色
	COLORREF  rgbLine; //6行4列, 每cell的颜色

	char szINI[MAX_PATH];

	BOOL  bLogMsg; //
};

typedef CList<CString, CString&> tagStringList;

typedef struct tagTip_Info
{
	HWND hWnd;
	char szTime[32];
	char szInfo[4 * 1024];
};

typedef CList<tagTip_Info, tagTip_Info&> tagTip_InfoList;

typedef struct tagLed_Info
{
	int  nXh;
	char szLed_ID[32];
	char szLed_Name[128];
	char szLed_Type[32];
	char szLed_IP[32];
	int  nLed_Port;
	int  nWidth;
	int  nHeight;
	char szDtu_ID[32];

	char szLed_Path[MAX_PATH];
	char szPlayListFile[MAX_PATH];
};

typedef CList<tagLed_Info, tagLed_Info&> tagLed_InfoList;

typedef struct tagGrid_Prop
{
	COLORREF rgbTitle;
	COLORREF rgbDateTime;
	COLORREF rgbLine;
	COLORREF rgbItem;
}GRID_PROP;

//1套
/*
非甲烷总烃
甲烷
总烃

苯
甲苯
二甲苯
*/

typedef struct tagSample_Para
{
	char szSample_Name[32];
	char szMolecular_Formula[32]; //Molecular formula
	DWORD wReg_Addr;
	int  nIntOrFloat; //整型还是浮点0-整型，1-浮点
	DWORD wStandard_Value;
	DWORD wSample_Value;

	int nFactor; //转换因子 (nFactor / 22.4) * ppm.
	char szUnit[32]; //2023-03-01, 单位
	char szDefault_Value[32]; //2023-03-07, 默认值

	time_t ttSendCmd;
}SAMPLE_PARA;

typedef CList<tagSample_Para, tagSample_Para&> tagSample_ParaList;

//2套
/*
非甲烷总烃
甲烷
总烃
*/

#endif